﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace ClientAPI
{
    class ChatLog
    {
        private ArrayList _log;

        public ChatLog()
        {
            _log = new ArrayList();
        }

        public ArrayList Log
        {
            get
            {
                return _log;
            }
        }

        public void AddMessage(string message)
        {
            if (message != null)
            {
                if (_log.Count <= 50)
                    _log.Add(message);
                else
                {
                    _log.RemoveAt(0);
                    _log.Add(message);
                }
            }
            else
                System.Diagnostics.Debug.WriteLine("Attempted to write null message");
        }

        public int GetSize()
        {
            return _log.Count;
        }

        public string GetMessageAt(int value)
        {
            string message;

            message = (string)_log[value];

            return message;
        }
    }
}
